package com.rover022.flixelgame.ui.heroresolve
{
	import com.bit101.components.Window;
	import com.greensock.events.LoaderEvent;
	import com.rover022.flixelgame.manager.EventHelper;
	import com.rover022.flixelgame.manager.ItemManager;
	import com.rover022.flixelgame.manager.PlayerManager;
	import com.rover022.flixelgame.ui.equipupgrade.GeneralityGridUI;
	import com.rover022.flixelgame.ui.equipupgrade.GeneralityPackageUI;
	import com.rover022.flixelgame.utils.MiniComponentTool;
	import com.rover022.flixelgame.vo.HeroVo;
	import com.rover022.flixelgame.vo.ItemVo;
	import flash.display.Sprite;
	import flash.events.MouseEvent;

	/**
	 * 所有的英雄展示界面
	 * 1展示所有的英雄头像
	 * 2控制队伍的次序
	 *
	 * @author flashpig
	 *
	 */
	public class HerosPackage extends GeneralityPackageUI
	{
		public function HerosPackage()
		{
			packageName = "HerosPackage";
			gridSize=108;
			initUI();
		}

		override public function initUI(e:LoaderEvent = null):void
		{
			var ui:Window = MiniComponentTool.getPopWindow(packageName, close);
			ui.width=600;
			addChild(ui);
			gridContainer = new Sprite();
			ui.content.addChild(gridContainer);
			var array:Array = PlayerManager.getInstance().getAllHeros();
			for (var i:int = 0; i < array.length; i++)
			{
				var herovo:HeroVo = array[i] as HeroVo;
				var grid:GeneralityGridUI = ItemManager.getInstance().makeGeneralityGrid(herovo);
				EventHelper.addEventListener(grid, MouseEvent.CLICK, gridClick);
				addGridToContainer(grid, false);
			}
			sortGrid();
		}

		
		override public function showGridInfo(item:*):void
		{
			
		}

		override public function sortGrid():void
		{
			super.sortGrid();
		}
	}
}
